import { createHashRouter, RouterProvider, Navigate } from 'react-router-dom'
import { Contacts } from '@/mobile/views/contacts'
import { Mine } from '@/mobile/views/mine'
import { Layout } from './layout'

export function Router() {
  return <RouterProvider router={router} />
}

const router = createHashRouter([
  {
    Component: Layout,
    children: [
      {
        path: '/contacts',
        Component: Contacts,
      },
      {
        path: '/mine',
        Component: Mine,
      },
      {
        path: '*',
        element: <Navigate to="/contacts" replace={true} />,
      },
    ],
  },
])
